import React, { memo } from 'react';

import ErrorBoundary from "./ErrorBoundary";

const wrapMemo = (func) => {
    const Comp = memo(func);

    const fn = (props) => {
        return (
            <ErrorBoundary>
                <Comp {...props}></Comp>
            </ErrorBoundary>
        );
    };

    fn.displayName = 'fn';
    
    return fn;
};

export default wrapMemo;